<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		输入你的电话号码：<input type="test" id="input1"  />
		<script>
			//keydown
			//keyup
			//keypress
			input1.onkeydown=function(e){
				console.log("键盘按下")
				console.log(e.key);
				console.log(e.keyCode);
				if(e.keyCode<48 || e.keyCode>57){
					event.preventDefault()
				}
			}
			input1.onkeyup=function(e){
				console.log("键盘抬起")
			}
			input1.onkeypress=function(e)
			{
				console.log("键盘按了")
			}
		</script>
	</body>
</html>
